package Comparator;

import geometric3D.Point;
import geometric3D.xLineSegment;

import java.util.Comparator;

public class xLimeSegmentComparator implements Comparator<xLineSegment> {

	@Override
	public int compare(xLineSegment o1, xLineSegment o2) {
		Point o1StartPoint = o1.getStartPoint();
		Point o1EndPoint = o1.getEndPoint();
		Point o2StartPoint = o2.getStartPoint();
		Point o2EndPoint = o2.getEndPoint();
		
		if(o1StartPoint.getY() > o2StartPoint.getY()){
			return -1;
		}else if(o1StartPoint.getY() < o2StartPoint.getY()){
			return 1;
		}else if(o1StartPoint.getX()> o2StartPoint.getX()){
			return 1;
		}else if(o1StartPoint.getX()< o2StartPoint.getX()){
			return -1;
		}else if(o1StartPoint.getZ()> o2StartPoint.getZ()){
			return 1;
		}else if(o1StartPoint.getZ()< o2StartPoint.getZ()){
			return -1;
		}else if(o1EndPoint.getX()> o2EndPoint.getX()){
			return 1;
		}else if(o1EndPoint.getX()< o2EndPoint.getX()){
			return -1;
		}
		
		
		

		return 0;
	}
	

}
